import Vue from "vue";
import VueRouter from "vue-router";
// import thecore from "../views/thecore/index.vue";
import index from "../views/index.vue";
import corestrengths from "../views/corestrengths/index.vue";
import productsandservices from "../views/productsandservices/index.vue";
import thesolution from "../views/thesolution/index.vue";
import aboutus from "../views/aboutus/index.vue";
Vue.use(VueRouter);

const routes = [
  {
    path: "",
    redirect: "/index",
  },
  {
    path: "/index",
    name: "首页",
    component: index,
    // redirect: "/thecore",
  },
  {
    path: "/corestrengths",
    name: "核心优势",
    component: corestrengths,
  },
  {
    path: "/productsandservices",
    name: "产品与服务",
    component: productsandservices,
  },
  {
    path: "/thesolution",
    name: "解决方案",
    component: thesolution,
  },
  {
    path: "/aboutus",
    name: "关于我们",
    component: aboutus,
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject);
  return originalPush.call(this, location).catch((err) => err);
};

export default router;
